<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>ecg-viewer-zoom-test</title>
<script type="text/javascript" language="javascript"
	src="ericsson_mhealth_mn_graphical_viewer_framework_web_service/ericsson_mhealth_mn_graphical_viewer_framework_web_service.nocache.js"></script>
<script src="http://code.jquery.com/jquery-latest.js"></script>

<link rel="stylesheet"
	href="http://github.com/jquery/qunit/raw/master/qunit/qunit.css"
	type="text/css" media="screen" />

<script type="text/javascript"
	src="http://github.com/jquery/qunit/raw/master/qunit/qunit.js"></script>
<script type="text/javascript" src="../js/core.js"></script>

<script>
		$(document).ready(function(){
	
			var setup = function(fn) {
			};

			module("initialization");
			test("basic initialization", function() {
				var zoom = new Zoom();
				equals(zoom.getTopX(), 0);
				equals(zoom.getTopY(), 0);
			});
	 
			test("setting X value", function() {
				var zoom = new Zoom();
				zoom.setTopX(10);
				zoom.setCurrentX(12);
				equals(zoom.getTopX(), 10);
			});
	 
			test("setting Y value", function() {
				var zoom = new Zoom();
				zoom.setTopY(15);
				zoom.setCurrentY(20)
				equals(zoom.getTopY(15), 15);
			});
	 
			test("setting X and Y value", function() {
				var zoom = new Zoom();
				zoom.setTopXY(11, 16);
				zoom.setCurrentXY(20,50);
				equals(zoom.getTopX(), 11);
				equals(zoom.getTopY(), 16);
			});
	 
			module("setting current values");
			test("setting current X and Y values", function() {
				var zoom = new Zoom();
				zoom.setTopXY(10, 15);
				zoom.setCurrentXY(12,17);
				equals(zoom.getTopX(), 10);
				equals(zoom.getTopY(), 15);
				equals(zoom.getBottomX(), 12);
				equals(zoom.getBottomY(), 17);
			});
	 
			test("setting current X and Y values in case when current X is lower then top X", function() {
				var zoom = new Zoom();
				zoom.setTopXY(10, 15);
				zoom.setCurrentXY(8,17);
				equals(zoom.getTopX(), 8);
				equals(zoom.getTopY(), 15);
				equals(zoom.getBottomX(), 10);
				equals(zoom.getBottomY(), 17);
			});
	 
			test("setting current X and Y values in case when current Y is lower then top Y", function() {
				var zoom = new Zoom();
				zoom.setTopXY(10, 15);
				zoom.setCurrentXY(12,3);
				equals(zoom.getTopX(), 10);
				equals(zoom.getTopY(), 3);
				equals(zoom.getBottomX(), 12);
				equals(zoom.getBottomY(), 15);
			});
	 
			test("setting current X and Y values in case when current X and Y are lower then top X and Y", function() {
				var zoom = new Zoom();
				zoom.setTopXY(10, 15);
				zoom.setCurrentXY(8,10);
				equals(zoom.getTopX(), 8);
				equals(zoom.getTopY(), 10);
				equals(zoom.getBottomX(), 10);
				equals(zoom.getBottomY(), 15);
			});
	 
			module("moving cursor");
			test("getting current width and height - testing when moving mouse towards bottom right corner", function() {
				var zoom = new Zoom();
				zoom.setTopXY(10, 15);
				zoom.setCurrentXY(20,20);
				equals(zoom.getCurrentHeight(), 5);
				equals(zoom.getCurrentWidth(), 10);
			});
	 
			test("getting current width and height - testing when moving mouse towards top left corner", function() {
				var zoom = new Zoom();
				zoom.setTopXY(10, 15);
				zoom.setCurrentXY(5,5);
				equals(zoom.getCurrentHeight(), 10);
				equals(zoom.getCurrentWidth(), 5);
			});
	 
			test("getting current width and height - testing when moving mouse downwards while X axis has the same value", function() {
				var zoom = new Zoom();
				zoom.setTopXY(10, 15);
				zoom.setCurrentXY(10,20);
				equals(zoom.getCurrentHeight(), 5);
				equals(zoom.getCurrentWidth(), 0);
			});
	 
			test("getting current width and height - testing when moving mouse upwords while X axis has the same value", function() {
				var zoom = new Zoom();
				zoom.setTopXY(10, 20);
				zoom.setCurrentXY(10,15);
				equals(zoom.getCurrentHeight(), 5);
				equals(zoom.getCurrentWidth(), 0);
			});
	 
			test("getting current width and height - testing when moving mouse right while Y axis has the same value", function() {
				var zoom = new Zoom();
				zoom.setTopXY(10, 15);
				zoom.setCurrentXY(20,15);
				equals(zoom.getCurrentHeight(), 0);
				equals(zoom.getCurrentWidth(), 10);
			});
	 
			test("getting current width and height - testing when moving mouse left while Y axis has the same value", function() {
				var zoom = new Zoom();
				zoom.setTopXY(10, 15);
				zoom.setCurrentXY(5,15);
				equals(zoom.getCurrentHeight(), 0);
				equals(zoom.getCurrentWidth(), 5);
			});

		});
  </script>

</head>

<body>
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
	style="position: absolute; width: 0; height: 0; border: 0"></iframe>
<h1 id="qunit-header">Ericsson Mobile Health - Client Side Unit
Tests - ECG Viewer</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>

<div></div>
</body>
</html>